improvement(knowledge): maintain keyword projections only for search indexes - #8333
waleedlatif1 merged 4 commits into
Conversation
…fill, and keep adopted Tin scoped
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
All reported issues were addressed across 12 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 12 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
embedding/document. The only live reader ofembedding_keyword_searchandembedding_keyword_tinis dormant indexed search, and only for bases that are search indexes. Yet every chunk write still upserted a keyword row, ran a TinDELETEon insert, and every document insert fanned an ACL/connector sync out to the projections0025_scope_keyword_projections, allCREATE OR REPLACEin one transaction with the 0024 lock-timeout retry:sync_embedding_keyword_searchtakes the shared membership lock and writes keyword rows only foris_search_indexbases. On an update that moves a chunk out of a search index, it deletes the chunk's rowDELETEon insert, since a new chunk can't have a Tin rowprojection_source_acl_syncbecomesAFTER UPDATE OF connector_id, acl ... WHENthe value actually changed. A new document has no chunks yet (FK), so the insert arm never matched anythingdb:push, and late Tin adoption end with the same trigger definitions: 0019 installs the final guarded, key-share-locked Tin triggers, and 0025 re-runs after 0016. Adb:pushre-run of the legacy 0016 backfill may refill keyword rows for non-search bases; they're unread and left in place like the existing onesFOR KEY SHARE, so a chunk delete racing an adoption is waited out instead of failing itembedding_keyword_search. Once 0025 has run, don't roll back below v0.9.2, and self-hosters should upgrade through v0.9.2 or laterType of Change
Testing
0025_scope_keyword_projections.integration.ts: insert scoping, move-out, adopt and un-adopt, commit and uncommitted-adoption races, no fan-out for inserted documents while a real ACL change still fans out, no-op adoption rewrites skipped, and late Tin adoption keeping the guarded trigger. Each fails with its guard revertedcheck:auditspassChecklist